<?php
	include_once("./commonality.php");
	//搜索功能模糊查询
	error_reporting(E_ALL^E_NOTICE^E_WARNING);
session_start();
	$find =$_POST['find'];
	if (isset($_POST['find'])) {	
		$set="select * from product where pname like '%$find%' or price like '%$find%'";
	}else{
		$set="select * from product";
	}
	$res=mysql_query($set);
	if(mysql_affected_rows()>0){
	while($list=mysql_fetch_assoc($res)){
	$sets[]=$list;
	//session_start();
 	}
 }
 //商品分类页的展示
?>
<!doctype html>
	<html>
	<head>	
	<meta charset="utf-8">
	</head>
	<style>
	
	#product{
		width:93%;
		height:1000px;
		/*border:2px solid #66ff33;*/
		margin-left:45px;
	}
	.product1 div{
		width:230px;
		height:370px;		
		margin-left:15px;
		text-align:center;
		float:left;
		margin-bottom:20px;
		
	}
	.product1 div:hover{
		/*border:1px solid #bdbdbd;*/
		box-shadow:0px 0px 12px #BFBFBF;
	}
	.c2{
		width:100%;
	}
	
	.c3{
		width:100px;
		height:30px;
		background:#57abff;
		line-height:30px;
		display:inline-block;
		line-height:30px;
		text-align:center;
		color:white;
		font-size:18px;
		border-radius:5px;
	}
	</style>
	<body>
		<?php include_once("./head.php"); ?>
	<div clear:both;></div>
	<hr width="93%">
		<div id="product">
			<div class="product1">
				<?php if(isset($sets)){
				foreach($sets as $key=>$value)  {  ?>
					<div>
					<a style="text-decoration:none;color:#4D5255" href="show.php?pid=<?= $value['pid']?>" >	
					<img class="c2" src="./uploads/<?= $value['pimg'] ?>"><br>		
					<span><font color="red" size="4px">￥</font><?= $value['price']?>&nbsp;</span><br><br>
					<span><?= $value['pname'] ?></span><br><br>
					<span class="c3">点击察看</span>
					</a>
					</div>
				<?php } }else{
						echo"未检索到宝贝";
				 }?>				
			</div>
			
		</div>
	<?php include_once("./foter.php");?>
	</body>
	</html>